<?php

namespace App\Admin\Extensions\Table;

use App\Admin\Repositories\Service;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class ServiceSelectTable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new Service('category'), function (Grid $grid) {
            $grid->disableCreateButton();
            $grid->disableBatchActions();
            $grid->disableActions();
            $grid->column('id','服务ID')->sortable();
            $grid->column('category.name','所属分类');
            $grid->column('image','服务图片')->image(null,50,50);
            $grid->column('title',"服务标题");
            $grid->column('subtitle','服务描述');
            $grid->column('price','服务价格');
            $grid->column('status')->radio(['正常','隐藏'],true)->label(['info','default']);
            $grid->column('created_at');
            $grid->quickSearch(['id','title','subtitle','category.name']);
            $grid->paginate(8);
        });
    }


}
